VERSION=''
re="\"(version)\": \"([^\"]*)\""

while read -r l; do
  if [[ $l =~ $re ]]; then
    value="${BASH_REMATCH[2]}"
    VERSION="$value"
  fi
done <package.json

PROJECT="stats-frontend"

BUILD_PACKAGE="${PROJECT}"

SVN_FOLDER="${PROJECT}"

rm -rf ${SVN_FOLDER}

mkdir ${SVN_FOLDER}

# npm run build

# 新版
cd ./html

tar --exclude '.DS_Store' --exclude '__MACOSX' -zcvf ${BUILD_PACKAGE}.tar.gz *

mv ${BUILD_PACKAGE}.tar.gz ../${SVN_FOLDER}

cp -r ../deploy/. ../${SVN_FOLDER}/
